package ioana.pack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AdaugaOras extends Activity implements OnClickListener
{
	Button ok,cancel;
	EditText text;
	 @Override
	    public void onCreate(Bundle savedInstanceState) 
	    {
		 super.onCreate(savedInstanceState);
	     setContentView(R.layout.adaugaoras);
	     ok=(Button)findViewById(R.id.buttonok);  
	     ok.setOnClickListener(this);
	     cancel=(Button)findViewById(R.id.buttoncancel);
	     cancel.setOnClickListener(this);	     
	     text=(EditText)findViewById(R.id.field);
	    }
	public void onClick (View v) 
	{
		// TODO Auto-generated method stub
		
		Button b=(Button) v;
		Intent adauga = new Intent ();
		String oras=text.getEditableText().toString();		
		adauga.putExtra("oras",oras);
		if (b==ok)
		{
			setResult(RESULT_OK, adauga);
		}
		else
		{   
			setResult(RESULT_CANCELED, adauga);	
		}
		finish();
	}
	 
}
